import pandas as pd
from matplotlib import pyplot as plt
df = pd.read_excel('女装销售数据.xlsx')
plt.rcParams['font.sans-serif'] = 'SimHei'
df['历史总订单数（单）'] = df['历史总订单数（单）'].apply(lambda x:x if type(x) !=str else x.replace('+','')).astype('int')
df_new = df[df['历史总订单数（单）'] ==1]
df_old = df[df['历史总订单数（单）']>1]
plt.figure()
data = [df_new.index.size,df_old.index.size]
plt.pie(data,labels=['新用户','老客户'],autopct='%.2f%%')
plt.title('新老客户人数占比饼状图')
plt.show()
